package com.zq.repository;

import com.zq.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @Author:任人渐疏
 * @Date:Created in 11:06 上午 2020/6/26
 * Update:true
 */
public interface UserRepository extends JpaRepository<User,Integer> , JpaSpecificationExecutor<User> {
    /** 根据用户名查询用户数据
     *@ClassName: UserRepository
     *@Description
     *@Author 任人渐疏
     *@Date 2020/6/26
     *@Time 11:39 上午
     */
    @Query(value="select  * from `user` where yonghuming=?1",nativeQuery = true)
    User findByUname(String  yongHuMing);
    /** 根据昵称查训
    *@ClassName: UserRepository
    *@Description
    *@Author 任人渐疏
    *@Date 2020/6/27
    *@Time 1:41 下午
    */
    @Query(value="select  * from `user` where nicheng=?1",nativeQuery = true)
    User findBynicheng(String  nicheng);
    @Query(value = "select * from `user`",nativeQuery = true)
    List<User> getAllUser();

}
